home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
tagsgen.exe
/
SHELL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-03-29
|
45KB
|
1,185 lines
/*
EPSHeader
File: tags.c
Author: J. Kercheval
Created: Sun, 03/31/1991 14:59:48
*/
/*
EPSRevision History
J. Kercheval Sun, 03/31/1991 16:24:01 creation
J. Kercheval Sun, 03/31/1991 16:43:18 allow @filename listfile syntax
J. Kercheval Tue, 05/14/1991 19:46:50 add tag_type
J. Kercheval Wed, 05/15/1991 18:19:22 add -m and -o parameters
J. Kercheval Wed, 05/15/1991 19:23:42 correctly parse for logfile
J. Kercheval Wed, 05/15/1991 22:22:33 add the sort module
J. Kercheval Thu, 05/16/1991 22:47:04 move file IO to fileio.c
J. Kercheval Wed, 06/26/1991 23:03:55 move back to standard IO
J. Kercheval Thu, 06/27/1991 21:43:11 create tags.h
J. Kercheval Fri, 07/12/1991 23:04:23 revise command line parsing
J. Kercheval Sat, 07/13/1991 11:29:02 update Usage()
J. Kercheval Sat, 07/13/1991 12:47:34 finish argf parsing
J. Kercheval Sat, 07/13/1991 13:06:16 move input routines to input.c
J. Kercheval Sun, 07/14/1991 19:18:36 finish DoTags
J. Kercheval Wed, 07/17/1991 22:18:58 allow append file logging
J. Kercheval Thu, 07/18/1991 18:53:31 use fully qualified input pathname
J. Kercheval Fri, 07/19/1991 20:15:43 allow sort only and non-sort options
J. Kercheval Sun, 07/21/1991 17:38:00 add post processing
J. Kercheval Mon, 07/22/1991 17:35:08 tweak log output and interface
J. Kercheval Sat, 07/27/1991 20:38:36 remove ASM public flag and post processing hooks
J. Kercheval Sat, 08/17/1991 23:03:47 enable c tagging
J. Kercheval Sun, 08/25/1991 22:49:55 fix bug in ASM flag parsing
J. Kercheval Thu, 08/29/1991 23:30:47 add CRC checking for virus check
J. Kercheval Sat, 08/31/1991 23:56:02 add prototype flag
J. Kercheval Thu, 09/05/1991 01:29:13 add input file name tracking
J. Kercheval Thu, 09/05/1991 01:29:42 add -t flag
J. Kercheval Thu, 09/05/1991 02:01:28 finish tag output logic
J. Kercheval Thu, 09/05/1991 20:07:45 move arglist processing to seperate module
J. Kercheval Thu, 09/05/1991 20:13:50 move MergeFile() to tagio.c
J. Kercheval Tue, 09/10/1991 23:24:27 add ctrl-c handler
J. Kercheval Wed, 09/11/1991 01:45:35 add usage comments for extern switch
J. Kercheval Tue, 09/17/1991 19:43:23 add support for case_sensitive flag
J. Kercheval Wed, 09/25/1991 13:42:28 support sorted arglists
J. Kercheval Wed, 09/25/1991 16:02:18 check for duplicate file names at the command line level
J. Kercheval Wed, 09/25/1991 22:47:37 supress tag file merge if not input files found
J. Kercheval Tue, 10/01/1991 19:30:26 close all open files in external_cleanup()
J. Kercheval Thu, 10/03/1991 13:55:09 add exclude file processing
J. Kercheval Thu, 10/03/1991 16:46:07 improve list file parsing
J. Kercheval Sat, 10/05/1991 10:56:18 add switch summary to usage
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#include "flags.h"
#include "log.h"
#include "wildfile.h"
#include "sort.h"
#include "ctag.h"
#include "asmtag.h"
#include "tagio.h"
#include "viruscrc.h"
#include "arglist.h"
#define Author "J. Kercheval"
#define Version "Tags Generator V1.7"
#define CompileDate __TIMESTAMP__
/* The following variables are pointers to the temporary filenames used as
* an intermediary files. These are globals for use in external_cleanup()
* to delete any temporary files. */
char *tmp_filename = NULL;
char *tmp_tagfilename = NULL;
/*----------------------------------------------------------------------------
*
* Print Usage
*
---------------------------------------------------------------------------*/
void Usage(char *fname)
{
fprintf(stdout, "\n%s %s -- %s\n\n", Version, CompileDate, Author);
fprintf(stdout, "Usage: %s {[OPTIONS] [SOURCEFILE|@LISTFILE]}\n\n",
fname);
fprintf(stdout, " -h,-? for extended usage output to stdout\n");
fprintf(stdout, " @LISTFILE for list file of input file names\n");
fprintf(stdout, " -x{EXCLUDEFILE|@LISTFILE} to exclude files\n");
fprintf(stdout, " -tTAGFILE to merge to a particular tag file\n");
fprintf(stdout, " -lLOGFILE for log file (-l overwrites, -L appends)\n");
fprintf(stdout, " -o[e5gsm] for output format\n");
fprintf(stdout, " -a[fdlmsu] to specify assembly tagging\n");
fprintf(stdout, " -c[dmstekuvcfpxi] to specify C tagging\n");
fprintf(stdout, " -q will suppress normal status output\n");
fprintf(stdout, " -r use relative pathnames in output\n");
fprintf(stdout, " -n do not sort the tag output\n");
fprintf(stdout, " -i use a case sensitive sort\n");
fprintf(stdout, " -m for merge sort of the existing sorted files\n");
fprintf(stdout, " -s sort input files only\n");
exit(1);
}
/*----------------------------------------------------------------------------
*
* Print Extended Usage
*
---------------------------------------------------------------------------*/
void Help(char *fname)
{
char usage[][85] =
{
" -h or -? to obtain this help screen\n",
" @LISTFILE for list file of input file names. A list file is in the form",
" of a response file (ie. a list of files seperated by some delimiter).",
" The allowed delimiters for file seperation are '+', ',', ';' and normal",
" whitespace. This file allows commented lines by preceding any comment",
" with a pound sign (#). A comment is from the '#' to the end of the",
" line and may start after any whitespace character\n",
" -x{EXCLUDEFILE|@LISTFILE} excludes the files specified by EXCLUDEFILE",
" or exclude all files listed in LISTFILE.\n",
" -tTAGFILE to output to a (possibly existing) tag file and will result in",
" previous tags for input files being removed from the output file.",
" This tagfile is assumed to be in one of this utilities output formats.",
" if -m or -s are used this switch is ignored (all output is to stdout).\n",
" -lLOGFILE for output to a log file in a LISTFILE format suitable as input.",
" behavior regarding existing files is determined by the case of the switch.",
" -l creates and outputs to a file overwriting any currently existing file",
" -L appends all output to the logfile if there is an already existing file\n",
" -o[options] for output format to stdout or the tag file if -t switch is used",
" e Epsilon >= V6.0 ( tokenString \\t fileName \\t characterOffset \\t line )",
" 5 Epsilon <= V5.03 ( tokenString;fileName;characterOffset )",
" g GNU tag ( tokenString \\t fileName \\t /$line^/ )",
" s Space-Delimited ( tokenString fileName lineNumber )",
" m MicroSoft Error ( tokenString fileName(lineNumber) )\n",
" -a[options] to specify assembly tagging and to detail the token types.",
" Default tagging is -afdlmsu (80x86 assembly using MASM/TASM syntax)",
" f procedure labels ( token proc )( proc token )",
" d definition labels ( token equ const )( token db declaration )",
" l local labels ( token label )( label token )( token: )",
" m macro labels ( token macro )( macro token )",
" s struc labels ( token struc )( struc token )",
" u union labels ( token union )( union token )\n",
" -c[options] to specify C tagging and to detail the token types. Default",
" tagging options are -cdmstekuvcfpxi (standard ANSI 2.0 C/C++). Note that",
" use of the -cx and the -ci switch are modifiers and will only be effective",
" when other options are used (ie. -cpx must be specified to obtain extern",
" prototypes, -cx alone yields nothing). Note that th